<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link href="BaiduStyle.css" type="text/css" rel="stylesheet" />
    <title>Baidu</title>
</head>
<body style="">
    <div class="box">
        <img src="../jsdom/images/1.jpg"/>
        <img src="../jsdom/images/2.jpg"/>
        <img src="../jsdom/images/3.jpg"/>
        <img src="../jsdom/images/4.jpg"/>
        <img src="../jsdom/images/5.jpg"/>
    </div>

    <script type="text/javascript">
        window.onload = function () {
            var images = document.getElementsByTagName("img");
            for (var i = 0; i < images.length; i++) {
                images[i].onclick = function () {
                    var imageSrc = this.src;
                    document.body.style.backgroundImage = "url(" + imageSrc + ")";
                }
            }
        }
    </script>
</body>
</html>